﻿using System;

namespace LA6
{
    /// <summary>
    /// The class used as nodes in the linked list.
    /// </summary>
    class ListNode
    {
        /// <summary>
        /// The name of the node.
        /// </summary>
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// The array of rules that replace the name.
        /// </summary>
        public string[] Rules
        {
            get;
            set;
        }

        /// <summary>
        /// A reference to the next node in the list.
        /// </summary>
        public ListNode NextNode
        {
            get;
            set;
        }

        /// <summary>
        /// A reference to the previous node in the list.
        /// </summary>
        public ListNode PreviousNode
        {
            get;
            set;
        }

        /// <summary>
        /// A constructor that only stores a name in the node.
        /// </summary>
        /// <param name="nameValue">A string value for the name of the node.</param>
        /// <param name="nextNodeValue">A reference to the next node in the list.</param>
        /// <param name="previousNodeValue">A reference to the previous node in the list.</param>
        public ListNode(string nameValue, ListNode nextNodeValue, ListNode previousNodeValue)
        {
            Name = nameValue;
            Rules = null;
            NextNode = nextNodeValue;
            PreviousNode = previousNodeValue;
        }

        /// <summary>
        /// A constructor that stores values for name and the rules that replace that name.
        /// </summary>
        /// <param name="nameValue">A string value for the name of the node.</param>
        /// <param name="rulesValue">A string array for the rules that replace the name.</param>
        /// <param name="nextNodeValue">A reference to the next node in the list.</param>
        /// <param name="previousNodeValue">A reference to the previou node in the list.</param>
        public ListNode(string nameValue, string[] rulesValue, ListNode nextNodeValue, ListNode previousNodeValue)
        {
            Name = nameValue;
            Rules = rulesValue;
            NextNode = nextNodeValue;
            PreviousNode = previousNodeValue;
        }
    }
}